package org.com.ashen.web.controller.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fcibook.quick.http.QuickHttp;
import org.apache.http.entity.ContentType;
import org.apache.log4j.Logger;
import org.com.ashen.common.common.HttpResult;
import org.com.ashen.service.config.JdbcConfig;
import org.com.ashen.service.util.DBUtil;
import org.com.ashen.service.util.FileUtil;
import org.com.ashen.web.constant.CommonUtils;
import org.com.ashen.web.constant.UrlConstant;
import org.com.ashen.web.param.GetSysWMParam;
import org.com.ashen.web.weimeng.receiveData.GetReceiveDataParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.io.IOException;
import java.sql.CallableStatement;
import java.sql.Connection;






@Controller
public class DataExchangeController {

	Logger log = Logger.getLogger(DataExchangeController.class);
	@Resource(name = "jdbcConfig")
	private JdbcConfig jdbcConfig;
	
	@RequestMapping(value = UrlConstant.GETMEMBERDETAIL, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String getMemberDetail(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/mc/member/getMemberDetail?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.ADDCLASSIFY, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addClassify(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsClassify/addClassify?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.UPDATECLASSIFY, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateClassify(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsClassify/updateClassify?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.QUERYCLASSIFYINFOLIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryClassifyInfoList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsClassify/queryClassifyInfoList?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	
	
	
	@RequestMapping(value = UrlConstant.QUERYGOODSRIGHTSLIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryGoodsRightsList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsRights/queryGoodsRightsList?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.ADDGOODSRIGHTSVALUE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addGoodsRightsValue(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsRights/addGoodsRightsValue?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.ADDGOODSRIGHTS, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addGoodsRights(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsRights/addGoodsRights?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	
	@RequestMapping(value = UrlConstant.QUERYCHILDRENCATEGORY, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryChildrenCategory(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/category/queryChildrenCategory?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	
	@RequestMapping(value = UrlConstant.QUERYCATEGORYATTRINFO, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryCategoryAttrInfo(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/category/queryCategoryAttrInfo?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.ADDATTRIBUTE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addAttribute(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/category/addAttribute?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	
	
	@RequestMapping(value = UrlConstant.ADDATTRVALUE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addAttrValue(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/category/addAttrValue?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.QUERYCATEGORYTREE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryCategoryTree(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/category/queryCategoryTree?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	
	@RequestMapping(value = UrlConstant.ADDPROP, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addProp(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsProperty/addProp?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.UPDATEPROP, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateProp(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsProperty/updateProp?accesstoken=";
		return commonRequest2(param,url);
	}
	

	@RequestMapping(value = UrlConstant.QUERYPROPLIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryPropList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsProperty/queryPropList?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.QUERYPROPDETAIL, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryPropDetail(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsProperty/queryPropDetail?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.QUERYPROPVALLIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryPropValList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsProperty/queryPropValList?accesstoken=" ;
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.ADDPROPVAL, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addPropVal(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsProperty/addPropVal?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	
	@RequestMapping(value = UrlConstant.UPDATESTOCKANDPRICE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateStockAndPrice(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/updateStockAndPrice?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.WHOLEUPDATESTOCK, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String wholeUpdateStock(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/wholeUpdateStock?accesstoken=";
		return commonRequest2(param,url);
	}
	
	

	@RequestMapping(value = UrlConstant.UPDATESTOCK, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateStock(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/updateStock?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.QUERYGOODSSTOCK, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryGoodsStock(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/queryGoodsStock?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.FINDGOODSTAGLIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String findGoodsTagList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsTag/findGoodsTagList?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.UPDATEGOODSTAG, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateGoodsTag(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsTag/updateGoodsTag?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.ADDGOODSTAG, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addGoodsTag(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goodsTag/addGoodsTag?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.UPDATEGOODS, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateGoods(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/updateGoods?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.QUERYGOODSLIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryGoodsList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/queryGoodsList?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.UPDATEGOODSSHELFSTATUS, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateGoodsShelfStatus(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/updateGoodsShelfStatus?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.QUERYGOODSDETAIL, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryGoodsDetail(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/queryGoodsDetail?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.UPDATEGOODSTITLE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateGoodsTitle(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/updateGoodsTitle?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.UPDATEGOODSDESC, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateGoodsDesc(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/updateGoodsDesc?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.UPDATEGOODSIMAGE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateGoodsImage(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/updateGoodsImage?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.UPDATEOUTERSKUCODE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateOuterSkuCode(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/updateOuterSkuCode?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.ADDGOODS, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addGoods(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/addGoods?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.QUERYGOODSURLLIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryGoodsUrlList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/queryGoodsUrlList?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.QUERYBASEGOODSLISTBYGOODSID, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryBaseGoodsListByGoodsId(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/queryBaseGoodsListByGoodsId?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	
	@RequestMapping(value = UrlConstant.QUERYSIMPLEGOODSLISTWITHPAGE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String querySimpleGoodsListWithPage(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/querySimpleGoodsListWithPage?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.QUERYGOODSDATA, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryGoodsData(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/data/queryGoodsData?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	
	@RequestMapping(value = UrlConstant.UPDATECOSTPRICE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateCostPrice(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/updateCostPrice?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.FINDPICKUPSITEBYPAGE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String findPickUpSiteByPage(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/merchant/findPickUpSiteByPage?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.ADDPICKUPSITE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addPickUpSite(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/merchant/addPickUpSite?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.UPDATEPICKUPSITE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updatePickUpSite(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/merchant/updatePickUpSite?accesstoken=" ;
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.OPENORCLOSEPICKUPSITE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String openOrClosePickUpSite(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/merchant/openOrClosePickUpSite?accesstoken=" ;
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.DELETEPICKUPSITE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String deletePickUpSite(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/merchant/deletePickUpSite?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.GETDETAILPICKUPSITE, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String getDetailPickUpSite(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/merchant/getDetailPickUpSite?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.FINDDELIVERYTYPELIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String findDeliveryTypeList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/findDeliveryTypeList?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.GETDIVISIONAREALIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String getDivisionAreaList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/address/base/getDivisionAreaList?accesstoken=";
		return commonRequest2(param,url);
	}
	

	@RequestMapping(value = UrlConstant.QUERYLOGISTICSCOMPANY, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryLogisticsCompany(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/logistics/queryLogisticsCompany?accesstoken=" ;
		return commonRequest2(param,url);
	}
	

	@RequestMapping(value = UrlConstant.OPERATEMERCHANTAPPID, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String operateMerchantAppId(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/decoration/operateMerchantAppId?accesstoken=" ;
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.CANCELORDER, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String cancelOrder(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/order/cancelOrder?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.UPDATEORDERFLAG, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateOrderFlag(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/order/updateOrderFlag?accesstoken=" ;
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.QUERYORDERLIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryOrderList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/order/queryOrderList?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.QUERYORDERDETAIL, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String queryOrderDetail(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/order/queryOrderDetail?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	
	@RequestMapping(value = UrlConstant.UPDATEITEMREMARK, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String updateItemRemark(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/order/updateItemRemark?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	
	@RequestMapping(value = UrlConstant.DELIVERYORDER, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String deliveryOrder(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/order/deliveryOrder?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.CHARGEOFF, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String chargeOff(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/order/chargeOff?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.STOCKUP, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String stockUp(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/order/stockUp?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.DELIVERYCITYORDER, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String deliveryCityOrder(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/order/deliveryCityOrder?accesstoken=" ;
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.SEARCHRIGHTSORDERLIST, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String searchRightsOrderList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/rights/searchRightsOrderList?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.GETRIGHTSORDERDETAIL, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String getRightsOrderDetail(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/rights/getRightsOrderDetail?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.AGREERIGHTSORDER, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String agreeRightsOrder(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/rights/agreeRightsOrder?accesstoken=" ;
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.CANCELRIGHTSORDER, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String cancelRightsOrder(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/rights/cancelRightsOrder?accesstoken=" ;
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.CONFIRMRECEIVEDRIGHTSGOODS, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String confirmReceivedRightsGoods(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/rights/confirmReceivedRightsGoods?accesstoken=" ;
		return commonRequest2(param,url);
	}
	
	
	
	
	
	@RequestMapping(value = {UrlConstant.RECEIVEDATA}, method = {RequestMethod.POST})
	@ResponseBody
	public String receiveData(@RequestBody String param) throws Exception{
		if(param!=null && !param.equals("")) {
			GetReceiveDataParam getReceiveDataParam= JSON.parseObject(param, GetReceiveDataParam.class);
			String publicAccountId = getReceiveDataParam.getId();
			
			System.out.println(publicAccountId);
			log.error(param);
			if ( publicAccountId==null) {
				return null;
			} else {
				String sql = "{call Up_WM_OrderMsg_Create(?,?,?,?,?,?)}";
				Connection conn = DBUtil.getRtsaasConnection(jdbcConfig);
				CallableStatement call = null;  
		        try {  
		            call = conn.prepareCall(sql); 
					call.setString(1, getReceiveDataParam.getId());
		            call.setString(2, getReceiveDataParam.getTopic());
		            call.setString(3, getReceiveDataParam.getEvent());
		            call.setString(4, getReceiveDataParam.getPublic_account_id().toString());
		            call.setString(5, getReceiveDataParam.getMsg_body());
		            call.setString(6, getReceiveDataParam.getVersion().toString());
		            call.execute();
		            DBUtil.closeConnection(call,conn);
		            JSONObject reJsonObject = new JSONObject();
					reJsonObject.put("errcode", 0);
					reJsonObject.put("errmsg", "success");
					JSONObject reJsonObject2 = new JSONObject();
					reJsonObject2.put("code", reJsonObject);
					log.error(JSON.toJSONString(reJsonObject2));
					System.out.println( JSON.toJSONString(reJsonObject2));
					return JSON.toJSONString(reJsonObject2);
		        }catch (Exception e) {
					return null;
				}
			}
		}else {
			return null;
		}
	}
	
	
	@RequestMapping(value = UrlConstant.FINDFREIGHTTEMPLATELIST,produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String findFreightTemplateList(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/findFreightTemplateList?accesstoken=";
		return commonRequest2(param,url);
	}
	
	
	@RequestMapping(value = UrlConstant.GETFREIGHTTEMPLATEDETAIL, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String getFreightTemplateDetail(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/getFreightTemplateDetail?accesstoken=";
		return commonRequest2(param,url);
		
	}
	
	@RequestMapping(value = UrlConstant.ADDFREIGHTTEMPLATE,produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String addFreightTemplate(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/ec/goods/addFreightTemplate?accesstoken=";
		return commonRequest2(param,url);
	}
	
	@RequestMapping(value = UrlConstant.GETAREASBYLOCATION, produces = CommonUtils.CONTENT_TYPE)
	@ResponseBody
	public String getAreasByLocation(String injson,String signtype) {
		GetSysWMParam param = new GetSysWMParam();
		param.setInjson(injson);
		param.setSigntype(signtype);
		String url = "https://dopen.weimob.com/api/1_0/address/base/getAreasByLocation?accesstoken=" ;
		return commonRequest2(param,url);
	}
	
	
	
	
	
	
	private String commonRequest2(GetSysWMParam param,String eventurl) {
		String signtype = param.getSigntype();
		String inJson = param.getInjson();
		if (signtype.equals("weimeng")) {
			try {
				String JsonString = FileUtil.getFileContent(CommonUtils.FILE_PATH);
				JSONObject jsonObject = JSON.parseObject(JsonString);
				String access_token = jsonObject.getString("weimengAccessToken");
				String url = eventurl+ access_token;
				log.error(url);
				String accessToke = new QuickHttp().url(url)
						.setContentType(ContentType.APPLICATION_JSON).addHeader("charset", "utf-8")
						.setBodyContent(inJson).post().text();
				log.error(access_token);
				return accessToke;
			} catch (IOException e) {
				log.error(e.getMessage());
				String errString = HttpResult.failedResultRtn(e.getMessage(), "").toString();
				return errString.replace("\\\"", "\"").replace("\"[", "[").replace("]\"", "]").replace("\"{", "{").replace("}\"", "}");
			}
		} else {
			return null;
		}
	}
}
